home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: manorton@aol.com (MANorton)
- Newsgroups: comp.lang.c++
- Subject: Getting Free Disk Space
- Date: 18 Jan 1996 11:16:10 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4dlroa$dvr@newsbf02.news.aol.com>
- Reply-To: manorton@aol.com (MANorton)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- I couldn't figure out a way to get the amount for getting free disk space
- on a disk from VB so I wrote a DLL. Everything is fine in VC but when I
- run it from VB I get an out of memory error. Can anyone tell me what's
- wrong or is there a better way to do this?
-
-
- /* free disk space DLL */
-
- #include <windows.h>
- #include <dos.h>
-
- long FAR PASCAL FreeDiskSpace (int cDrive)
- {
- struct _diskfree_t drive;
- long lFreeDiskSpace = -1;
- unsigned iDrv = 0;
-
- if (('A' <= cDrive) && (cDrive <= 'Z')) iDrv = cDrive - 'A';
- if (('a' <= cDrive) && (cDrive <= 'z')) iDrv = cDrive - 'a';
-
- /* Get information on disk specified by cDrive or default disk
- drive 0 */
- if (! _dos_getdiskfree( iDrv, &drive ))
- lFreeDiskSpace = (drive.avail_clusters *
- drive.sectors_per_cluster * drive.bytes_per_sector) / 1024;
-
- return lFreeDiskSpace;
- }
-
-
-
- int FAR PASCAL LibMain (HANDLE hInstance, WORD wDataSeg, WORD wHeapSize,
- LPSTR lpszCmdLine)
- {
- if (wHeapSize > 0)
- UnlockData (0);
- return (0);
- }
-
- void FAR PASCAL WEP (int nParameter)
- {
- return;
- }
-
-
- M
-